<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <script src="/vue.js"></script>
  <body>
    <div id="app">
      <App></App>
    </div>
  </body>
  <script>
    const Header = {
      name: "Header",
      template: `
      <h2>Header</h2>
      `,
    };

    /* 
        使用Vue.component('组件名称',组件)对某个组件进行全局注册
      */
    Vue.component("Header", Header);

    const App = {
      name: "App",
      template: `
      <div><h1>App组件</h1>
        <Header></Header>
        </div>
      
      `,
    };
    const vm = new Vue({
      el: "#app",
      components: {
        App,
      },
      data() {
        return {};
      },
    });
  </script>
</html>
